package com.expertria.glex.view;

 

import com.expertria.glex.view.layout.AbsoluteLayout;
import com.expertria.glex.view.layout.ILayout;
import com.expertria.glex.view.renderer.IRenderer;
import com.google.gwt.dom.client.Style.Overflow;

/**
 * 
 * @author hushunjie
 * A List that has a scroll bar 
 *
 */
public class ScrollList extends Group implements IList, IRepeater{

	private List list; 
	public ScrollList(ILayout layout)
	{
		//the scroll list does not care, it just have a div
		super(new AbsoluteLayout());
		list = new List(layout);
		this.add(list);
		
		this.getElement().getStyle().setOverflow(Overflow.AUTO);
	}
 
	
	@Override
	public void setData(Object data) {
		
		list.setData(data);
	}
	
	@Override
	public void setRender(IRenderer renderer) {
		
		list.setRender(renderer);
	}
	
	@Override
	public int getSelectedIndex() {
		return list.getSelectedIndex();
	}
	
	public void setSelectedIndex(int i) 
	{
		list.setSelectedIndex(i);
	};
}
